const path = require('path');
const { NamedModulesPlugin } = require('webpack');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const { merge } = require('webpack-merge');
const baseConfig = require('./webpack.base');

module.exports = merge(baseConfig, {
    mode: 'development',
    devtool: 'source-map',
    devServer: {
        contentBase: path.resolve(__dirname, '../dist'),
        port: 8001,
        host: 'localhost',
        open: true,
        proxy: {
            '/api': {
                target: 'http://blogapi.w-ming99.cn',
                pathRewrite: {
                    '/api': ''
                }
            }
        }
    },
    plugins: [
        new ForkTsCheckerWebpackPlugin(),
        new NamedModulesPlugin(),
    ]
});